
	<?php
        header("Content-Type:text/html;charset=utf-8");
		if(isset($_REQUEST['name_1'])&&isset($_REQUEST['title'])&&isset($_REQUEST['email'])){
		  $name = $_REQUEST['name_1'];
          $title = $_REQUEST['title'];
          @$body_1 = $_REQUEST['body_1'];
          $email = $_REQUEST['email'];
         // echo $email;
          @$birthday =$_REQUEST['birthday'];
          $ip = $_SERVER['SERVER_ADDR'];
          $public_date = date("Y-m-d,H:i:s");
          //echo $ip;
          $conn =@ mysql_connect('localhost','root','12345');
          if($conn){
          	$db = mysql_select_db('study_day1',$conn);
          	//数据库编码
			mysql_query("set names utf8");
          	$sql = "insert into board (`name`,`title`,`body_1`,`email`,`birthday`,`ip`,`public_date`) values ('$name','$title','$body_1','$email','$birthday','$ip','$public_date');";
          	 //echo $sql;
          	 //$sql_1 = "select name='$name'  from board;";
          	if(mysql_query($sql)){
          		echo "录入成功<br/>";
          		mysql_close($conn);
          		 // 延迟一段时间后重定向redrict with delay: 
          		 header("Refresh: 5; url=php_cgi.php"); 
          		 print "You will be redirected in 5 seconds";
          		 
          	}else{
          		echo "录入数据失败";
          		mysql_close($conn);
          		// 延迟一段时间后重定向redrict with delay:
          		header("Refresh: 5; url=cg4.html");
          		print "You will be redirected in 5 seconds";
          	}
          }
		}
	?>
